﻿<phone:PhoneApplicationPage 
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
	xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:Microsoft_Phone_Controls_Maps="clr-namespace:Microsoft.Phone.Controls.Maps;assembly=Microsoft.Phone.Controls.Maps"
	mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
	x:Class="AuchanScan.HistoriquePage"
	Orientation="Portrait"
	shell:SystemTray.IsVisible="True">

	<phone:PhoneApplicationPage.FontFamily>
		<StaticResource ResourceKey="PhoneFontFamilyNormal"/>
	</phone:PhoneApplicationPage.FontFamily>
	<phone:PhoneApplicationPage.FontSize>
		<StaticResource ResourceKey="PhoneFontSizeNormal"/>
	</phone:PhoneApplicationPage.FontSize>
	<phone:PhoneApplicationPage.Foreground>
		<StaticResource ResourceKey="PhoneForegroundBrush"/>
	</phone:PhoneApplicationPage.Foreground>

	<!--LayoutRoot is the root grid where all page content is placed-->
	<Grid x:Name="LayoutRoot">
			<Grid.Background>
				<ImageBrush Stretch="Fill" ImageSource="/images/Page_Background.png" />
			</Grid.Background>

        <!--ContentPanel - place additional content here-->
			<Grid x:Name="ContentPanel" Margin="12,110,12,0">
				<Grid d:LayoutOverrides="Width, Height" Margin="12,0">
					<Grid.RowDefinitions>
						<RowDefinition Height="0.538*"/>
						<RowDefinition Height="0.462*"/>
					</Grid.RowDefinitions>
                <ListBox x:Name="LbHisto" ItemsSource="{Binding Datas.Histories}" ItemContainerStyle="{StaticResource StretchListBoxItemStyle}" Foreground="#DEFFFFFF">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Grid>
                            	<Grid.RowDefinitions>
                            		<RowDefinition Height="Auto"/>
									<RowDefinition Height="*"/>                    	
								</Grid.RowDefinitions>
                            	<Grid.ColumnDefinitions>
                            		<ColumnDefinition Width="Auto"/>
									<ColumnDefinition Width="*"/>                    	
								</Grid.ColumnDefinitions>
                        		<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" Margin="12,0">
                            		<TextBlock Text="Liste d'achats du " d:LayoutOverrides="Width" VerticalAlignment="Center" Style="{StaticResource PhoneTextTitle3Style}" Margin="0" Foreground="#DE000000"/>
                            		<TextBlock Text="{Binding Date, StringFormat='dd/MM/yy'}" d:LayoutOverrides="Width" VerticalAlignment="Center" Style="{StaticResource PhoneTextTitle3Style}" Margin="0" Foreground="#DE000000"/>
                            	</StackPanel>
                            	<Grid>
                            		<Rectangle Fill="{StaticResource AccentBrushHistorique}" Width="48" Height="48"/>
                            		<Image Source="/icons/appbar.caddie.rest.png" Stretch="Fill" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                            	</Grid>
                            	<ListBox x:Name="ListArticles" ItemsSource="{Binding Achats}"
                            		ItemContainerStyle="{StaticResource StretchListBoxItemStyle}"
                            		Grid.Row="1" Grid.Column="1">
                            		<ListBox.ItemTemplate>
                            			<DataTemplate>
                            				<Grid>
                            					<Grid.RowDefinitions>
                            						<RowDefinition Height="auto" />
                            						<RowDefinition Height="auto" />
                            					</Grid.RowDefinitions>
                            					<Grid.ColumnDefinitions>
                            						<ColumnDefinition Width="30" />
                            						<ColumnDefinition Width="*" />
                            						<ColumnDefinition Width="60" />
                            					</Grid.ColumnDefinitions>
                            					<TextBlock Text="{Binding Quantity}" HorizontalAlignment="Left" />
                            					<TextBlock Text="{Binding Product.Name}" Grid.Column="1" />
                            					<TextBlock Text="{Binding TotalPrice, StringFormat='{0}€'}" Grid.Column="2" HorizontalAlignment="Right" />
                            					<Grid Visibility="{Binding HasPromo, Converter={StaticResource VisibilityConverter}}" Grid.Row="1"
                            						Grid.ColumnSpan="2">
                            						<Rectangle Visibility="{Binding UsePromo, Converter={StaticResource VisibilityConverter}}"
                            							Width="12" Height="12" Fill="{StaticResource AccentBrushHistorique}" HorizontalAlignment="Left" />
                            						<Border Width="4" Background="{StaticResource AccentBrushHistorique}" HorizontalAlignment="Left"
                            							Margin="20,0,0,0" />

                            						<TextBlock Text="{Binding Promotion.Comment1}" Margin="26,0,0,0" Foreground="#DEFFFFFF" />

                            					</Grid>
                            				</Grid>
                            			</DataTemplate>
                            		</ListBox.ItemTemplate>
                            	</ListBox>
                        	</Grid>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
				</Grid>
			</Grid>
			<Image Height="64" Source="/images/herbe.png" Stretch="Fill" VerticalAlignment="Bottom" Margin="0,0,0,8"/>
			<Rectangle Fill="{StaticResource AccentBrushHistorique}" Height="8" VerticalAlignment="Bottom"/>
			<Image Source="/AuchanScan;component/images/Logo.png" HorizontalAlignment="Left" Height="66.5550003051758" MaxHeight="50"
				Margin="24,12,0,689" d:LayoutOverrides="GridBox" />
		</Grid>
</phone:PhoneApplicationPage>